<?php

namespace Apps\Common\Models;

/**
 * 美容院评论Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class BeautyParlorComment extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $comment_id;

    /**
     *
     * @var integer
     */
    public $beauty_parlor_id;

    /**
     *
     * @var integer
     */
    public $user_id;

    /**
     *
     * @var string
     */
    public $comment_info;

    /**
     *
     * @var string
     */
    public $comment_photos;

    /**
     *
     * @var integer
     */
    public $comment_floor;

    /**
     *
     * @var integer
     */
    public $comment_state;

    /**
     *
     * @var string
     */
    public $comment_addtime;

    /**
     *
     * @var string
     */
    public $comment_reply;

    /**
     *
     * @var string
     */
    public $comment_reply_addtime;
    
    //新增字段
    public $type;
    
    public $appointment_id;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->belongsTo('beauty_parlor_id', 'Apps\Common\Models\BeautyParlor', 'bp_id', array('alias' => 'BeautyParlor'));
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'beauty_parlor_comment';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return BeautyParlorComment[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return BeautyParlorComment
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'comment_id' => 'comment_id',
            'beauty_parlor_id' => 'beauty_parlor_id',
            'user_id' => 'user_id',
            'comment_info' => 'comment_info',
            'comment_photos' => 'comment_photos',
            'comment_floor' => 'comment_floor',
            'comment_state' => 'comment_state',
            'comment_addtime' => 'comment_addtime',
            'comment_reply' => 'comment_reply',
            'comment_reply_addtime' => 'comment_reply_addtime',
        	'type' => 'type',	
        	'appointment_id' => 'appointment_id'
        );
    }

    public function defaultColumns()
    {
        return [
            'comment_state',
            'comment_addtime',
            'comment_reply',
            'comment_reply_addtime',
        ];
    }

}
